home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / amac44a.zip / MIS007.QM < prev    next >
Text File  |  1992-06-22  |  16KB  |  387 lines

  1. *                               mis007.qm
  2. *                 Macros To Set/Delete Custom Tab Stops
  3. *                        Written By Tom Hogshead
  4. *       Modifications to Macros Originally Written By John Goodman
  5. *                       [ See MISCxx.QM For Use ]
  6. *                                 6/2/92
  7. *  Key                         Description
  8. * ===== =================================================================
  9. *        Set/Delete Tab Stops...
  10. *  @0  - Set Standard Custom Tab Stops at Columns 5, 10, ... 75 ( )
  11. *  @1  - Set/Delete   Custom Tab Stops by Column Number
  12. *                                                             Like  w/Ins
  13. *        Move Cursor...                                       ----- -----
  14. *  @2  -     to Previous Custom Tab Stop                      TabLt  Off
  15. *  @3  -     to Next     Custom Tab Stop                      TabRt  Off
  16. *        Tab...
  17. *  @4  -     to Previous Custom Tab Stop, Shift Text Left     TabLt  On
  18. *  @5  -     to Next     Custom Tab Stop, Shift Text Right    TabRt  On
  19. *
  20. *  @6  - Delete All Custom Tab Stops
  21. *
  22. *       {e:\up\MISC*}   Return To MISCxx.QM
  23. *
  24. *-- eoi
  25.  
  26.  
  27.  
  28. *     DESCRIPTION
  29. *     ------------
  30. *     These macros enable the user to set and/or delete custom tab
  31. *     stops.  I have modified the macros, originally written by John
  32. *     Goodman in SemWare Macros Conference 3, Message #431, 6-25-91, to
  33. *     take advantage of QEdit v2.15 SetScreenOFF|ON commands and to
  34. *     work irrespective of all qconfig settings.  These modified macros
  35. *     are also in AMAC43.ZIP, mis007.qm with different key assignments.
  36.  
  37. *     NOTE:   If this macro is invoked on line 1 and qconfig is set to
  38. *             insert lines *below* current line, macros @0 and @2-5
  39. *             will add one extra line on top of file.  All macros,
  40. *             except @0 and @1, will fit on one line of qconfig.dat by
  41. *             removing "Label" from Qmac compiled macro and formatting
  42. *             to a right margin of 500.  All macros require QEdit v2.15.
  43.  
  44.  
  45. *                          M A C R O S
  46. * ----------------------------------------------------------------------
  47. * @(0) Set Standard Custom Tab Stops At Columns 5, 10, 15, ... 75
  48. * ----------------------------------------------------------------------
  49. * This macro sets custom tab stops at columns 5, 10, 15, ...  75 either
  50. * by invoking this macro while editing or at the command line to edit
  51. * [file]:
  52.  
  53. *             q. [file]     /Emis007.mac    /Lmis007.mac
  54.  
  55. * For example, to load this file from the command line with a standard
  56. * set of custom tab stops at columns 5,10...75, use the command:
  57.  
  58. *             q. mis007.qm /Emis007.mac     /Lmis007.mac
  59.  
  60. * Change Gotocolumn lines for different custom tab stops.
  61.  
  62. @0  MacroBegin
  63.     SetScreenOff SaveSettings SetWordWrapMode ToggleWordWrap
  64.     GetScrBuff          * Try retrieving existing tab ruler
  65.       "TAB" Return      *  buffer
  66.  JTrue LOOP             * If found, set standard tab stops
  67.                         *--Create Tab Ruler if it doesn't exist
  68.     InsertLine          * Insert line above
  69.     AddLine             * Add line below
  70.     BegLine
  71.     MarkCharacter       * Start block
  72.     "vvvv5vvvv0"        * Type ruler chars
  73.     Copy                * Copy the block
  74.     BegLine             * Return to line begin
  75.     Paste               * Paste copy of ruler chars
  76.     RepeatCmd           * Paste 6 more copies for 80 char ruler
  77.       "6" Return
  78.     MarkLine            * Mark both created lines
  79.     CursorUp
  80.  LOOP:
  81.     iscursorinblock     * Test if cursor is in block
  82.  JTrue IN_BLOCK         * If true, we're set to insert above line or
  83.                         * tab ruler did not exist
  84.     cursorup            *ELSE qconfig set to insert *below* line
  85.  JTrue NOT_LINE#1       * If we can cursor up, we're not on line 1
  86.     insertline          *ELSE, we're on line 1, make room to move block
  87.  NOT_LINE#1:
  88.     moveblock           * Move block above current line
  89.  IN_BLOCK:
  90.     gotoblockbeg        * Move cursor to block begin
  91.     begline deltoeol    * Delete tab ruler buffer
  92.     gotocolumn  "5" return "T" gotocolumn "10" return "T"
  93.     gotocolumn "15" return "T" gotocolumn "20" return "T"
  94.     gotocolumn "25" return "T" gotocolumn "30" return "T"
  95.     gotocolumn "35" return "T" gotocolumn "40" return "T"
  96.     gotocolumn "45" return "T" gotocolumn "50" return "T"
  97.     gotocolumn "55" return "T" gotocolumn "60" return "T"
  98.     gotocolumn "65" return "T" gotocolumn "70" return "T"
  99.     gotocolumn "75" return "T"
  100.  END:
  101.     StoreScrBuff        * Store the TAB ruler
  102.       "TAB" Return
  103.     SetScreenOn
  104.     DeleteBlock         * Get rid of the ruler lines
  105.     RestoreSettings
  106. *
  107. * 194 bytes Wed  02-12-1992  14:52:25 (TH @0)
  108. * 199 bytes Thu  02-13-1992  11:04:42 (TH @0, OK if on line 1)
  109.  
  110. * 
  111. * ----------------------------------------------------------------------
  112. * @(1) Set/Delete Custom Tab Stops by Column Number
  113. * ----------------------------------------------------------------------
  114. * Invoke this macro to set or delete a custom tab stop.  Insert desired
  115. * tab stop column number at the pause, or "0" or "1" to end macro.
  116.  
  117. *     EXAMPLES
  118. *     ---------
  119. *         a)  To set custom tab stops at columns 5, 10 and 15 with @1:
  120.  
  121. *                              5 <enter>
  122. *                             10 <enter>
  123. *                             15 <enter>
  124. *                              0 <enter>      (Stops macro)
  125.  
  126. *         b)  To remove custom tab stop at column 10 with @1:
  127.  
  128. *                             10 <enter>
  129. *                              0 <enter>      (Stops macro)
  130.  
  131. @1  MacroBegin
  132.     SetScreenOff SaveSettings SetWordWrapMode ToggleWordWrap
  133.     GetScrBuff          * Try retrieving existing tab ruler
  134.       "TAB" Return      *  buffer
  135.  JTrue LOOP             * If found, allow user to change it
  136.                         *--Create Tab Ruler if it doesn't exist
  137.     InsertLine          * Insert line above
  138.     AddLine             * Add line below
  139.     BegLine
  140.     MarkCharacter       * Start block
  141.     "vvvv5vvvv0"        * Type ruler chars
  142.     Copy                * Copy the block
  143.     BegLine             * Return to line begin
  144.     Paste               * Paste copy of ruler chars
  145.     RepeatCmd           * Paste 6 more copies for 80 char ruler
  146.       "6" Return
  147.     MarkLine            * Mark both created lines
  148.     CursorUp
  149.  LOOP:                  * Loop until user stops
  150.  
  151.     SetScreenOn
  152.     GotoColumn          * Prompt user for tab column number
  153.       Pause Return      * If user enters Return,0,or 1,
  154.     SetScreenOff
  155.     BegLine             * Begline will not move (user done)
  156.  JFalse END
  157.     PrevPosition        * Go back to user's column
  158.     GotoBlockBeg        * Reqd if Qconfig set to insert blocks *below* line
  159.     MarkColumn          * Mark current & previous char
  160.     CursorLeft
  161.     Find "T" Return     * Test if 'T' already in column
  162.          "L" Return
  163.  JTrue DELTAB           * If 'T' there, go delete it
  164.     CursorRight         * 'T' not there, add one & make sure
  165.     CursorRight         * any following it are not shifted
  166.     BackSpace "T"       * regardless of Ins mode
  167.  Jump OKAY
  168.  DELTAB:
  169.     CursorRight         * Delete 'T' regardless of Ins mode
  170.     BackSpace " "
  171.  OKAY:                  * 'T' added or deleted, re-mark
  172.     CursorDown          * both lines of tab ruler
  173.     MarkLine
  174.     CursorUp
  175.  Jump LOOP              * Prompt user for another column #
  176.  END:
  177.     StoreScrBuff        * Store the TAB ruler
  178.       "TAB" Return
  179.     DeleteBlock         * Get rid of the ruler lines
  180.     RestoreSettings
  181. *
  182. *  98 bytes Fri  05-31-1991  00:09:37 (JG @1)
  183. * 102 bytes Thu  02-06-1992  12:31:47 (TH @1, mod to JG @1)
  184. * 103 bytes Wed  02-12-1992  12:19:02 (TH @1, for all qconfig's)
  185.  
  186. * 
  187. * ----------------------------------------------------------------------
  188. * @(2) Move Cursor to Previous Custom Tab Stop
  189. * ----------------------------------------------------------------------
  190. @2  MacroBegin
  191.     SetScreenOff
  192.     GetScrBuff          * Retrieve Tabs Ruler Buffer
  193.       "TAB" Return
  194.  JFalse END             * End macro if buffer not defined
  195.     iscursorinblock
  196.  JTrue ABOVE            * Test if Qconfig set to insert blocks *below* line
  197.     cursorup            * If false, Qconfig set to insert blocks *below*
  198.                         *  line, position to move block above line
  199.  JTrue MOVE             * Test if we're on line 1
  200.     insertline          *ELSE we must be on line 1, make room to moveblock
  201.  MOVE:
  202.     moveblock           * Move block above line
  203.  ABOVE:
  204.     GotoBlockBeg        * Reqd if Qconfig set to insert blocks *below* line
  205.     WordLeft            * Move to previous 'T'; if before 1st 'T'
  206.                         *   will move to end of previous line
  207.     EndLine             * Endline will not move if on prev line
  208.     iscursorinblock
  209.  JTrue 1                * Test if cursor on line above Tabs Ruler Buffer
  210.     cursordown          * If false, move down to begin of Tabs Ruler Buffer
  211.     begline             * Move to col 1
  212.  Jump 2
  213.  1:
  214.     PrevPosition        * If true, return to previous position
  215.  2:
  216.     DelLine DelLine     * Delete tabs ruler lines and retain cursor column
  217.  END:
  218. *
  219. * 20 bytes Thu  05-30-1991  23:18:53 (JG @2)
  220. * 22 bytes Thu  02-06-1992  11:35:36 (TH @2, mod to JG @2)
  221. * 37 bytes Mon  02-10-1992  17:47:10 (TH @2, for all Qconfig settings)
  222. * 41 bytes Tue  02-11-1992  14:12:14 (TH @2, OK if on line 1)
  223.  
  224.  
  225. * 
  226. * ----------------------------------------------------------------------
  227. * @(3) Move Cursor to Next Custom Tab Stop, Beeps If Beyond Last Tab
  228. * ----------------------------------------------------------------------
  229. @3  MacroBegin
  230.     SetScreenOff SaveSettings SetSoundOn
  231.     GetScrBuff          * Retrieve Tabs Ruler Buffer
  232.       "TAB" Return
  233.  JFalse END             * End macro if buffer not defined
  234.     iscursorinblock
  235.  JTrue ABOVE            * Test if Qconfig set to insert blocks *below* line
  236.     cursorup            * If false, Qconfig set to insert blocks *below*
  237.                         *  line, position to move block above line
  238.  JTrue MOVE             * Test if we're on line 1
  239.     insertline          *ELSE we must be on line 1, make room to moveblock
  240.  MOVE:
  241.     moveblock           * Move block above line
  242.  ABOVE:
  243.     GotoBlockBeg        * Reqd if Qconfig set to insert blocks *below* line
  244.     Find "T" Return
  245.          "L" Return
  246.     DelLine DelLine     * Delete tabs ruler lines and retain cursor column
  247.  END:
  248.     RestoreSettings
  249. *
  250. * 24 bytes Mon  06-24-1991  19:00:18 (JG @3)
  251. * 29 bytes Thu  02-06-1992  11:35:32 (TH @3, mod to JG @3)
  252. * 35 bytes Mon  02-10-1992  17:40:34 (TH @3, for all Qconfig settings)
  253. * 39 bytes Tue  02-11-1992  14:05:50 (TH @3, OK if on line 1)
  254.  
  255. * 
  256. * ----------------------------------------------------------------------
  257. * @(4) Tab Left to Previous Custom Tab Stop, Shift Text Left
  258. * ----------------------------------------------------------------------
  259. * This macro shifts all text right of cursor LEFT to first previous
  260. * custom tab stop, like tablt with Insert On except if a single char is
  261. * in col 1, the cursor is positioned in col 2.
  262.  
  263. @4  MacroBegin
  264.     SetScreenOff
  265.     isbegline
  266.  JTrue END              * End macro if at line begin
  267.     splitline           *ELSE split line at current position
  268.     GetScrBuff          * Retrieve Tabs Ruler Buffer
  269.       "TAB" Return
  270.  JFalse END             * End macro if buffer not defined
  271.     iscursorinblock
  272.  JTrue ABOVE            * Test if Qconfig set to insert blocks *below* line
  273.     cursorup            * If false, Qconfig set to insert blocks *below*
  274.                         *  line, position to move block above line
  275.  JTrue MOVE             * Test if we're on line 1
  276.     insertline          *ELSE we must be on line 1, make room to moveblock
  277.  MOVE:
  278.     moveblock           * Move block above line
  279.  ABOVE:
  280.     GotoBlockBeg        * Reqd if Qconfig set to insert blocks *below* line
  281.     MarkColumn
  282.     CursorRight         * Move right
  283.     EndLine             * Test if at end of ruler
  284.  JTrue NEXTSTOP
  285.     CursorLeft          * If at end, move back 2 spaces
  286.     CursorLeft
  287.  NEXTSTOP:
  288.     PrevPosition        * Return to original position (unless
  289.     CursorLeft          *   at exact end of ruler tested above)
  290.     wordleft            * Move to previous 'T'
  291.     isendline
  292.  JFalse NO_EOL          * Test if at end of line
  293.     cursordown          * If at end of line move down to
  294.     begline             *   begin of line
  295.  NO_EOL:
  296.     cursordown          * Move down to ruler key line
  297.     delline             * Delete it
  298.     markcolumn          * Extend block to current line
  299.     gotoblockend
  300.     cursorleft          * Move to end of block 1 char left
  301.     endline             * Move to end of line
  302.  JTrue EOL              * Test if we were already at eol
  303.     cursorleft          * If already at end of line, move one char left
  304.  EOL:
  305.     iscursorinblock
  306.  JTrue INBLOCK          * Test if cursor in block
  307.     gotoblockbeg        * If not, move to tab stop
  308.     cursordown          * Position to rejoin
  309.  INBLOCK:
  310.     joinline            * Joinline
  311.     cursorup delline    * Delete tab stop line
  312.     unmarkblock         * Unmark current line
  313.  END:
  314. *
  315. * 65 bytes Mon  02-10-1992  17:49:32 (TH @4)
  316. * 69 bytes Tue  02-11-1992  14:12:44 (TH @4, OK if on line 1)
  317.  
  318. * 
  319. * ----------------------------------------------------------------------
  320. * @(5) Tab Right to Next Custom Tab Stop, Shift Text Right
  321. * ----------------------------------------------------------------------
  322. * This macro shifts all text right of cursor RIGHT to next custom tab
  323. * stop, like tabrt with Insert On.
  324.  
  325. @5  MacroBegin
  326.     SetScreenOff
  327.     GetScrBuff          * Retrieve Tabs Ruler Buffer
  328.       "TAB" Return
  329.  JFalse END             * End macro if buffer not defined
  330.     iscursorinblock
  331.  JTrue ABOVE            * Test if Qconfig set to insert blocks *below* line
  332.     cursorup            * If false, Qconfig set to insert blocks *below*
  333.                         *  line, position to move block above line
  334.  JTrue MOVE             * Test if we're on line 1
  335.     insertline          *ELSE we must be on line 1, make room to moveblock
  336.  MOVE:
  337.     moveblock           * Move block above line
  338.  ABOVE:
  339.     GotoBlockBeg        * Reqd if Qconfig set to insert blocks *below* line
  340.     MarkColumn
  341.     CursorRight         * Move right
  342.     EndLine             * Test if at end of ruler
  343.  JTrue NEXTSTOP
  344.     CursorLeft          * If at end, move back 2 spaces
  345.     CursorLeft
  346.  NEXTSTOP:
  347.     PrevPosition        * Return to original position (unless
  348.     CursorLeft          *   at exact end of ruler tested above)
  349.     WordRight           * Move to next 'T'; if beyond end of ruler
  350.                         *   will move to 1st char of next line
  351.     BegLine             * Begline will not move if on 2nd line
  352.     PrevPosition        * Return to last position
  353.     MarkColumn
  354.     GotoBlockBeg
  355.     Copy
  356.     DelLine DelLine     * Delete tabs ruler lines and retain cursor column
  357.     Paste
  358.     FillBlock
  359.       " " Return
  360.     DelCh
  361.     GotoBlockEnd
  362.     CursorLeft
  363.     UnmarkBlock
  364.  END:
  365. *
  366. * 42 bytes Fri  05-31-1991  00:39:58 (JG @6)
  367. * 44 bytes Thu  02-06-1992  11:35:40 (TH @5, mod to JG @6)
  368. * 50 bytes Mon  02-10-1992  17:46:51 (TH @5, for all Qconfig settings)
  369. * 54 bytes Tue  02-11-1992  14:12:29 (TH @5, OK if on line 1)
  370.  
  371. * 
  372. * ----------------------------------------------------------------------
  373. * @(6) Delete All Custom Tab Stops
  374. * ----------------------------------------------------------------------
  375. @6  macrobegin
  376.     getscrbuff "TAB" return   * Retrieve Tabs Ruler Buffer
  377.  JFalse END
  378.     begline
  379.     gotoblockbeg              * Need if qconfig set to insert *below* line
  380.     deltoeol                  * Delete all tab stops
  381.     storescrbuff "TAB" return * Store Ruler Buffer  - no tab stops
  382.     deleteblock               * Delete Ruler Buffer - no tab stops
  383.     prevposition begline      * Need if qconfig set to insert *below* line
  384.  END:
  385. *
  386. * 29 bytes Wed  02-12-1992  14:59:47 (TH @6)
  387.